#include <IceUtil/Thread.h>
#include <IceUtil/CtrlCHandler.h>
#include <vector>
#include <signal.h>
#include <filosofo.h>

using namespace std;

int
main (int argc, char *argv[]) {
  vector<Palillo*> palillos;
  vector<IceUtil::ThreadControl> threads;
  int i;

  for (i = 0; i < 5; i++)
    palillos.push_back(new Palillo);

  for (i = 0; i < 5; i++) {
    IceUtil::ThreadPtr t = new FilosofoThread(i, palillos[i], palillos[(i + 1) % 5]);
    threads.push_back(t->start());
  }

  for (vector<IceUtil::ThreadControl>::iterator i = threads.begin();
       i != threads.end(); 
       ++i) 
    i->join();

  return 0;
}
